Reserved Words, Remarks and Spacing

RESERVED WORDS

Words that are deemed to be reserved are the commands of the language. You will not be able to name your variables, arrays or user functions if they exist as part of the language as commands. As you become more familiar with the language, you will be able to naturally avoid using reserved words for your variable and array names.


REMARKS

You are able to write statements in your program that will be completely ignored when run. This may seem strange at first, but actually provides one of the most important features of your programming armoury. Remarks, also known as code commentary or documentation, are the plain English descriptions of what your program does at any point in the code.

Although BASIC is quite concise as a readable language, it's never entirely clear what a piece of code is supposed to do if you read it for the first time. Do not be fooled into thinking the code you write yourself is for your eyes only. Returning to a piece of code you write 3 months previous will dispel any concerns you may have over the importance of remarks.

The trick is to write only a summary of what a piece of code does. Leave out details, data and snippets that may change or be removed. Avoid typing a half-page description as the likelihood is that you'll never find the time to read it. Remarks become a highly powerful part of your program if used correctly.

You can use the REM command to make a comment, as follows:

REM Print a greeting for the user
PRINT "Hello World"
There are other ways to make remarks in a program, such as the single open quote symbol:

` Print a greeting for the user
PRINT "Hello World"
If you wish to 'comment out' a number of lines in your program, you can avoid adding a REM command at the start of each line by using the following:

REMSTART
PRINT "Hello World"
PRINT "Hello World"
PRINT "Hello World"
REMEND
Anything between the REMSTART command and the REMEND command will be ignored when the program is run. These commands are especially useful for temporarily removing parts of the program for testing purposes.


USE OF SPACING

Unlike other BASIC languages, spaces are very important in your programs. It is important to separate commands and parameters, otherwise your program will not be understood. Take for example the line:

FOR T=1 TO 10
This would not be recognized if written as:

FORT=1TO10
Nor would this be easy to read either. Providing you use spaces to separate commands and parameters, you will encounter no problems with spacing.